package com.yjzx.util.service.http.bean;

/**
 * @author yjzx
 * @date 2024/6/3
 * @description RetEnum
 */
public enum RetEnum {
    /**
     * 系统繁忙
     */
    busyError(-1, "系统繁忙,稍后重试"),
    ok(0, "请求成功"),
    sigError(4001, "签名错误"),
    paramError(4003, "参数不合法"),
    requestError(4004, "请求业务参数不合法"),
    systemError(500, "系统错误"),
    unknownError(4040, "未知错误");
    private final int status;
    private final String message;

    public int getStatus() {
        return status;
    }

    public String getMessage() {
        return message;
    }

    RetEnum(int status, String message) {
        this.status = status;
        this.message = message;
    }

    public static RetEnum getRetEnum(Integer status) {
        for (RetEnum value : values()) {
            if (value.status == status) {
                return value;
            }
        }
        return unknownError;
    }
}
